{{indexmenu_n>27}}
====== SiteExport Plugin Config ======

**NOTE**: USE A LOCAL DOKUWIKI FOR SUCCESS __The only way found to get a single continuous and complete document exported is to download the dokuwiki to a local computer and to run the plugin completely locally, due to an excessive number of failures which require "exclusion" of the last page.__

Time Settings:
  * PHP max_execution_time  45 minutes
  * Configuration:    plugin siteexport cachetime | 60*60*24 |
  * Configuration:    plugin siteexport max_execution_time | 10000 |

The SiteExport Plugin is used to export the **User Manual** (compressed siteexport.zip with multiple page html & images). The Opencpn_User_Manual **TOC** page:

See **[[:opencpn:opencpn_user_manual:toc|opencpn:opencpn_user_manal:toc]]**

is used to provide a "hyperlinked page-by-page" **Table of Contents** which is required to export the User Manual.

==== IndexMenu Plugin Code to create the TOC ====

There is more information about configuration of the [[https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:opencpn_user_manual:edit_user_manual:test_navigation_toc|IndexMenu Plugin & TOC]] here, but the syntax and code we need in the TOC page to create the **Flat open TOC** is:

  CODE: {{indexmenu>:opencpn:opencpn_user_manual#5|msort nsort nojs}}   

See **[[:opencpn:opencpn_user_manual:toc|opencpn:opencpn_user_manal:toc]]**   for the result.
 
To see this code, navigate to the TOC page above and use **DWedit** (right hand menu second button from the bottom to expose the code, you need edit rights). \\

 ==== Exporting Steps ====

  - Navigate to the OpenCPN User Manual **[[:opencpn:opencpn_user_manual:toc|TOC]]**.
  - **ADMIN > ADDITIONAL PLUGINS** (toward the bottom) **> SITE EXPORT**
  - Make sure the settings are [[opencpn:developer_manual:siteexport_config#configuration_settings_which_work]] as below. 
  - 3 Optional Start Buttons: Used to copy code from one of the buttons for a given download method. Each button has parameters from the configuration settings and code that can be copied to the clipboard.
      - Top Button - Direct http download code
      - Middle Button - Wget download code
      - Bottom Button - Curl download code
  - Hit **SAVE**  This results in reading each page and finally a Download prompt.
  - The plugin immediately starts "Adding "opencpn:developer_manual:vector_palette" ( 10 / 73 )"
  - Blue stripes running across or it failed
  - Also you can hit "Update"

====Configuration Settings used in 1/2018====
The settings used were:
From the [[https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:opencpn_user_manual:toc_offline_user_manual|Offline TOC page]] OR [[https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:opencpn_user_manual|Opencpn User Manual page]]

  - Select from the page's right menu, the icon second from the bottom //Export SiteExport//
  - Set Namespace= //opencpn:opencpn_user_manual:toc_offline_plugins_manual//
  - Parent Namespace to Export= //opencpn:opencpn_user_manual:toc_offline_plugins_manual//
  - Select //Export all subnamespaces//
  - To begin disable the **Export linked pages** option. Once it processes completely, then  //Check// to have **Links** in the document.
  - Export all parameters "do"  //Check//
  - Render Engine: //ckedit//
  - Template: //dokuwiki//
  - Everything else is //unchecked//
  - Just hit **Start** (without first hitting one of the three "Direct", "Wget" or "Curl" buttons)
  - When clicking the **Start** button it should show you that it will export x/y pages.
  - Message: //Adding "opencpn:opencpn_user_manual:advanced_features:network_repeater" ( 29 / 385 )// 
  - When the plugin completes you will be prompted to download the //siteexport.zip// file.

==== Configuration Settings which worked 2016====

Except levels and Exclusion.
  - Note: Export of other Books is similar, but with the path changed.\\
  - Set Namespace: **opencpn:opencpn_user_manual:toc** <-Point to TOC! \\
  - Parent Namespace to export: **opencpn:opencpn_user_manual** <-Point to parent namespace!\\
  - Export Type: **Specified Depth**  or This Page, All Subnamespaces (but includes blank pages) \\
  - Depth: **5** \\
  - Export Linked Pages:**checked** <-Want linked html pages - is this what it does?
  - Export all parameters (eg. "do"): **checked** <-What the parameters & what does this do?
  - Render Engine: **ckgedit**   or dw2pdf, sitepdf, etc.
  - Export Template: **bootstrap3**
  - Use TOC in Namespace: **Not Checked** <-what is this used for?
  - Empty namespaces in TOC: **Not Checked** <-what is this used for?
  - Default Lang: **EN**
  - Disable JavaScript in Plugins: "un-checked"  <-better to leave it off if possible.
  - All other parameters are left not checked.

==== Admin > Config down to SiteExport Settings which work ===

These are the settings which should be used in the **Admin > Config** down to SiteExport 
^ Parameter Description ^ Value |
| plugin export allowallusers | Checked |
|plugin siteexport default depth | 5 |
| plugin siteexport zipfilename | opencpn:siteexport.zip |
| plugin siteexport exclude | .pdf zip 7z blank blank.txt github cruisersforum edit_user_manual gallery_boats place_view |  
| plugin siteexport max_execution_time | 10000 |
| plugin siteexport ignoreNon200 | checked |
| plugin siteexport ignoreAJAXError | checked |
| plugin siteexport debugLevel | debug |
| plugin siteexport debugFile | /tmp/siteexport.txt |
| plugin siteexport cachetime | 60*60*24 |
| plugin siteexport PDFHeaderPagebreak | 1 |
| plugin siteexport  seOddEven | not checked |
| plugin siteexport defaultAuthenticationUser | admin |
| plugin siteexport defaultAuthenticationPassword | blank |
| plugin siteexport useProxy | blank |
| plugin siteexport offSiteLinkTemplate | blank |

==== Pages that had to be Excluded====

Refer to [[opencpn:developer_manual:failure_to_export|SiteExport-Failure to Export]]

Configuration > SiteExport > Excludes   (such as this)

Keep this List of Excludes for later!

options_setting:ships display gps_setup_and_status vector_display_tab gallery_boats opencpn:toc opencpn:user_corner opencpn:supplementary_hardware opencpn:supplementary_software opencpn:developer_manual editors toolbar_buttons toolbar_buttons:tides_and_currents toolbar_buttons:route_mark_manager toolbar_buttons:create_route opencpn_user_manual:toolbar_buttons:ais ais:sart plugins:weather:weatherfax radar_overlay_ais:ais_radar_display charts:nv_charts weather:weather_routing weather:climatology utility_plugins:object_search charts:bsb4_charts utility_plugins:launcher sailing_tools:tactics safety:watchdog navigation:dr_dead_reckoning plugins:safety:sar safety:odraw1.4_pi advanced_features:portable_opencpn_v2 radar_overlay_ais:br24_radar navigation:celestial_navigation included_plugins:grib_weather charts:vfkaps options_setting:connections gps_setup_and_statusvector_display_tab .pdf zip 7z edit_user_manual blank blank.txt cruisersforum github

Leaving this in the Excludes field:      .pdf zip 7z edit_user_manual blank blank.txt cruisersforum github

==== IndexMenu Plugin Code : Detail ====

To Export OpenCPN User Manual TOC  we want a non-expandable flat TOC with every page shown in proper order.

%%{{indexmenu>:opencpn:opencpn_user_manual#5|msort nsort nojs}}%%

  - Use the User Manual path ':opencpn:opencpn_user_manual'
  - Use '#6' to 'open' the tree down 6 levels.
  - Use 'msort' to sort pages by their meta tag indexmenu_n>N
  - Don't use 'navbar' because it is not needed. \\
  - Use 'nojs' Don't use javascript because tree is open. \\

==== Three Method Buttons above SAVE : Detail ====

**Top Button**  - %%https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn&addParams=1&defaultLang=en&depth=4&depthType=0.0&do=siteexport&ens=opencpn&exportLinkedPages=1&renderer=&template=bootstrap3%%

**Middle Button** - %%wget --max-redirect=4 --output-document=siteexport.zip --post-data="id=opencpn&addParams=1&defaultLang=en&depth=4&depthType=0.0&do=siteexport&ens=opencpn&exportLinkedPages=1&renderer=&template=bootstrap3" https://opencpn.org/wiki/dokuwiki/doku.php?id=doku.php --http-user=USER --http-passwd=PASSWD%%

**Bottom Button** - %%curl -L --max-redirs 4 -o siteexport.zip -d "id=opencpn&addParams=1&defaultLang=en&depth=4&depthType=0.0&do=siteexport&ens=opencpn&exportLinkedPages=1&renderer=&template=bootstrap3" https://opencpn.org/wiki/dokuwiki/doku.php?id=doku.php --anyauth --user USER:PASSWD%%

==== It's not working : Where is the debug file? ====

Debugging must be activated from **ADMIN > CONFIG** and Browser file>"find" "siteexp" go down and change these parameters:

plugin»siteexport»debugFile \\
Debug File        **/tmp/siteexport.txt **   Made the directory and file.

plugin»siteexport»zipfilename \\
Wiki Path and name for exported ZIP file  **opencpn:siteexport.zip**

plugin»siteexport»exclude \\
Pattern to exclude resources **.gov|favicon|advanced_chart_work|gshhshires**


==== Use Media Manager to locate the Debug File ====

Then click on the **Home** button, from the dropdown button pick **Media Manager** 

**[[https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn&do=media&ns=]]**

and look under the directories for **root** then look for the **debug.txt** file or in our case **debug3.txt**.  You can click on it to get it into the window, then click on the file name to download it. View it with something like NotePad++.  The last error will be at the end.

Each time SiteExport is used it leaves a file here, browse to root:opencpn directory. Use Media Manager to see

**[[https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn&do=media&ns=debug3.txt]]**


